﻿<local:ItemForm x:Class="WpfApp1.Views.Workers.WorkersList.WorkersListItem"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1.Views"
        mc:Ignorable="d"
        ResizeMode="NoResize"
        Icon="\Resources\wb.ico"
        Height="450" Width="342">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="50" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" Grid.ColumnSpan="3">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Label Grid.Column="0" Grid.Row="0" Content="Id" VerticalContentAlignment="Center"/>
            <TextBox x:Name="tbId" 
                     Width="200"
                     Grid.Column="1"
                     Grid.Row="0"
                     HorizontalAlignment="Left"
                     Margin="0 5" 
                     Text="{Binding CurrentItem.Id, Mode=OneWay}" 
                     IsReadOnly="True" 
                     Style="{StaticResource CommonTextBox}">
            </TextBox>

            <Label Grid.Column="0" Grid.Row="1" Content="Логин" VerticalContentAlignment="Center"/>
            <TextBox x:Name="tbLogin" 
                     Grid.Column="1" 
                     Grid.Row="1" 
                     Margin="0 5" 
                     Width="200"
                     HorizontalAlignment="Left"
                     Text="{Binding CurrentItem.WorkerLogin, UpdateSourceTrigger=PropertyChanged}" 
                     Style="{StaticResource CommonTextBox}"/>

            <Label Grid.Column="0" Grid.Row="2" Content="Фамилия" VerticalContentAlignment="Center"/>
            <TextBox x:Name="tbLastname" 
                     Grid.Column="1" 
                     Grid.Row="2" 
                     Margin="0 5" 
                     Width="200"
                     HorizontalAlignment="Left"
                     Text="{Binding CurrentItem.Lastname, UpdateSourceTrigger=PropertyChanged}" 
                     Style="{StaticResource CommonTextBox}"/>

            <Label Grid.Column="0" Grid.Row="3" Content="Имя" VerticalContentAlignment="Center"/>
            <TextBox x:Name="tbFirstname" 
                     Grid.Column="1" 
                     Grid.Row="3" 
                     Margin="0 5" 
                     Width="200"
                     HorizontalAlignment="Left"
                     Style="{StaticResource CommonTextBox}" 
                     Text="{Binding CurrentItem.Firstname, UpdateSourceTrigger=PropertyChanged}" />

            <Label Grid.Column="0" Grid.Row="4" Content="Отчество" VerticalContentAlignment="Center"/>
            <TextBox x:Name="tbPatronymic"
                     Grid.Column="1" 
                     Grid.Row="4" 
                     Margin="0 5" 
                     Width="200"
                     HorizontalAlignment="Left"
                     Style="{StaticResource CommonTextBox}" 
                     Text="{Binding CurrentItem.Patronymic, UpdateSourceTrigger=PropertyChanged}" />

            <Label Grid.Column="0" Grid.Row="5" Content="Номер телефона" VerticalContentAlignment="Center"/>
            <TextBox x:Name="tbPhoneNumber" 
                     Grid.Column="1" 
                     Grid.Row="5" 
                     Margin="0 5" 
                     Width="200"
                     HorizontalAlignment="Left"
                     Style="{StaticResource CommonTextBox}" 
                     Text="{Binding CurrentItem.PhoneNumber, UpdateSourceTrigger=PropertyChanged}" />

            <Label Grid.Column="0" Grid.Row="6" Content="Дата рождения" VerticalContentAlignment="Center"/>
            <DatePicker x:Name="calendarBirthday" 
                        Grid.Column="1"
                        Grid.Row="6" 
                        SelectedDate="{Binding CurrentItem.DateOfBirthday}" 
                        Width="200"
                        Margin="0 5" 
                        HorizontalAlignment="Left"/>

            <Label Grid.Column="0" Grid.Row="7" Content="Пол" VerticalContentAlignment="Center"/>
            <StackPanel Grid.Row="7" Grid.Column="1">
                <RadioButton x:Name="rbMale" GroupName="Gender" Content="Мужчина" IsChecked="{Binding CurrentItem.IsMale, Mode=OneWay}"/>
                <RadioButton x:Name="rbFemale" GroupName="Gender" Content="Женщина" IsChecked="{Binding CurrentItem.IsFemale, Mode=OneWay}"/>
            </StackPanel>

            <Label Grid.Column="0" Grid.Row="8" Content="Должность" VerticalContentAlignment="Center"/>
            <ComboBox x:Name="cbPost" 
                      Grid.Column="1"
                      Grid.Row="8"
                      Width="200"
                      Margin="0 5" 
                      HorizontalAlignment="Left"
                      ItemsSource="{Binding Posts}"
                      SelectedValue="{Binding CurrentItem.Post}"
                      Style="{StaticResource CommonComboBox}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Title}"/>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>

            <StackPanel Grid.Column="1"
                        Grid.Row="9"
                        Margin="10 0">
                <Button x:Name="btnChangePassword"
                    Margin="10 5" 
                    Width="130" 
                    HorizontalAlignment="Right" 
                    Template="{StaticResource commonButton}"
                    Command="{Binding TryChangePasswordCommand}">Изменить пароль</Button>
            </StackPanel>
        </Grid>
        <DockPanel Grid.Row="1" Margin="10" Grid.ColumnSpan="3">
            <Button x:Name="btnDataAction" Margin="10 0" Width="90" HorizontalAlignment="Left" Template="{StaticResource commonButton}" Command="{Binding SaveCommand}">Сохранить</Button>
            <Button x:Name="btnClose" Margin="10 0" Width="90" HorizontalAlignment="Right" Template="{StaticResource commonButton}" Click="btnClose_Click">Закрыть</Button>
        </DockPanel>
    </Grid>
</local:ItemForm>
